package com.neusoft.nepm.controller;

import com.neusoft.nepm.vo.ResponseData;
import com.neusoft.nepm.po.Supervisor;
import com.neusoft.nepm.service.ISupervisorService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author zouran
 * createDate：2023/6/19  9:53
 * 公众监督员控制层
 */
@RestController
@RequestMapping("/supervisor")
@Api(tags = "公众监督员管理接口")
public class SupervisorController {

    @Autowired
    private ISupervisorService service;

    /**
     * 公众监督员登录接口
     * @param supervisor
     * @return
     */
    @ApiOperation(value = "公众监督员登录方法")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "telId",value = "手机号"),
            @ApiImplicitParam(name = "password",value = "密码")

            })
    @ApiResponses({
            @ApiResponse(code=1001,message = "手机号或密码格式不正确"),
            @ApiResponse(code=2001,message = "用户不存在")
    })
    @PostMapping("/getSupervisorByIdByPass")
    public ResponseData getSupervisorByIdByPass(@RequestBody Supervisor supervisor){
        return service.getSupervisorByIdByPass(supervisor);
    }

    //查询手机号是否已经被注册
    @GetMapping("/getSupervisorById")
    @ApiOperation(value = "公众监督员手机号检测")
    public ResponseData getSupervisorById(String telId){
        return  service.getSupervisorById(telId);
    }

    //注册功能
    @PostMapping("/saveSupervisor")
    @ApiOperation(value = "公众监督员注册功能")
    public ResponseData saveSupervisor(@RequestBody Supervisor supervisor){
        return  service.saveSupervisor(supervisor);
    }
}